// 版权归 瞄你个汪 所有。使用本代码应遵守相关法律法规和Apache 2.0开源许可要求。
package top.geeke.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.Data;
import lombok.EqualsAndHashCode;
import top.geeke.entity.base.EntityBase;
import top.geeke.eunm.SysStatusEnum;
import top.geeke.toolkit.eunm.Description;
import top.geeke.toolkit.supertable.annotation.SuperColumn;
import top.geeke.toolkit.supertable.annotation.SuperIndex;
import top.geeke.toolkit.supertable.annotation.SuperTable;

import java.io.Serializable;
import java.util.List;

/**
 * <p>
 * 系统组织机构表
 * </p>
 * @author 瞄你个汪
 * @since 2024-05-01 12:00:00
 */
@Data
@EqualsAndHashCode(callSuper = true)
@TableName(value = "sys_org")
@SuperTable(value = "系统组织机构表", isSystem = true, indexes = {
        @SuperIndex(indexName = "sys_index_{table}_N", indexFields = "orgName"),
        @SuperIndex(indexName = "sys_index_{table}_C", indexFields = "orgCode"),
        @SuperIndex(indexName = "sys_index_{table}_T", indexFields = "orgType"),
})
public class SysOrg extends EntityBase implements Serializable {
    private static final long serialVersionUID = 1L;

    @SuperColumn(value = "父ID")
    private Long pId;

    @SuperColumn(value = "名称")
    private String orgName;

    @SuperColumn(value = "编码", nullable = true)
    private String orgCode;

    @SuperColumn(value = "级别", nullable = true)
    private Integer orgLevel;

    @SuperColumn(value = "机构类型", nullable = true)
    private String orgType;

    @SuperColumn(value = "负责人ID", nullable = true)
    private Long directorId;

    @Description("是否禁止选中")
    @TableField(exist = false)
    private boolean disabled;

    @SuperColumn(value = "状态")
    private SysStatusEnum status = SysStatusEnum.Enabled;

    @SuperColumn(value = "排序", defaultValue = "100")
    private Integer orderNo = 100;

    @SuperColumn(value = "备注", nullable = true, length = 128)
    private String remark;

    @JsonIgnore
    @JsonIgnoreProperties
    @TableField(exist = false)
    private SysOrg parentOrg;

    @JsonIgnore
    @JsonIgnoreProperties
    @TableField(exist = false)
    private SysUser director;

    @JsonIgnore
    @JsonIgnoreProperties
    @TableField(exist = false)
    private List<SysOrg> children;
}
